home *** CD-ROM | disk | FTP | other *** search
/ boe.pres.k12.wv.us / boe.pres.k12.wv.us.zip / boe.pres.k12.wv.us / Utilities / Xerox Workcentre 5335 / Windows Scan / 32-bit_x86 / Francais / cpsimage.cab / data / docio / tifffxFmtAdj.elf < prev    next >
Text File  |  2009-03-16  |  2KB  |  64 lines

  1. /*
  2. ** This script is used as part of the document library.
  3. ** Images processed for TIFF-FX have to conform to fixed parameters.
  4. ** This script takes an input XIPIMAGE and correct parameters to
  5. ** fix the image.
  6. */
  7.  
  8. IMPORT XIPIMAGE inImg, outImg;
  9. IMPORT INTEGER  dw, dh;
  10. IMPORT STRING   outfile;
  11. IMPORT INTEGER  outphoto;
  12.  
  13. // SetStatus (op: "debug");
  14. #load "xipProcs/printImageLayers.proc";
  15. LoadClasses ( filename: "xeng" );
  16.  
  17. INTEGER photo = inImg.getMember (num: 0, member: "photometry");
  18. INTEGER bits  = inImg.getMember (num: 0, member: "bits");
  19. INTEGER  comp = inImg.getMember (num: 0, member: "compression");
  20. INTEGER   pix = inImg.getMember (num: 0, member: "pixels");
  21. INTEGER   sln = inImg.getMember (num: 0, member: "scanlines");
  22.  
  23. // debug info
  24. // print PrintImageLayers (img: inImg);
  25. // print dw,dh, Photo2Str(photo: photo), Photo2Str(photo: outphoto), CompType (comp: comp), outfile;
  26.  
  27. inImg = inImg.unCompress();
  28.  
  29.  
  30. // Width correction
  31. if ( dw < pix )
  32.   inImg = inImg.scale ( awindow: (dw,sln) );
  33. else if ( dw > pix )
  34.   inImg = inImg.pad ( bytes: (dw+7)/8, pixel:TRUE );
  35.  
  36. // Height correction
  37. if ( dh < sln )
  38.   inImg = inImg.scale ( awindow: (pix,dh) );
  39. else if ( dh > sln )
  40.   inImg = inImg.frame ( thick: (0,0,0,dh-sln), value: (255), outside: TRUE );
  41.  
  42.  
  43. // Correct photometry
  44. if ( outphoto == XIP_ITULAB_COLOR )
  45.   inImg = inImg.cspace ( outspace: "itulab"); 
  46.  
  47.  
  48. // Get back to original bits and compression
  49. STRING cstr = CompressionStr (comp: comp); 
  50. if      ( cstr.strcasecmp (str: "jp") )  cstr = "jpeg";
  51. else if ( cstr.strcasecmp (str: "jb") )  cstr = "jbig2";
  52.  
  53. inImg = inImg.convert ( to: (bits)
  54.       ).compress (type: cstr
  55.       ).exec(
  56.       );
  57.  
  58. inImg.imageWidth  = inImg.getMember (num: 0, member: "pixels");
  59. inImg.imageHeight = inImg.getMember (num: 0, member: "scanlines");
  60. inImg.setMember ( member: "width",  value: inImg.imageWidth );
  61. inImg.setMember ( member: "height", value: inImg.imageHeight );
  62. // print PrintImageLayers (img: inImg), "\n";
  63. outImg = inImg;
  64.